import { request } from '@/apis';
import { addPrefix } from '@/utils/helper';
import { type GreenCreditParams } from './types';

const prefixUrl = '/ep-query';

const Api = {
  getOrganizationType: '/screen/organizationType',
  getIndicators: '/screen/esgGreenCreditIndicator',
  getTagYear: '/getTagYear',
  getCurrency: '/screen/currencyCode',
  getGreenCredit: '/getGreenCredit'
};

addPrefix(Api, prefixUrl);

export * from './types';

/** 获取机构类型 */
export const getOrganizationType = () => request.get({ url: Api.getOrganizationType });

/** 获取指标 */
export const getIndicators = () => request.get({ url: Api.getIndicators });

/** 获取年度 */
export const getTagYear = (dimensionCode: number) => request.get({ url: Api.getTagYear, params: { dimensionCode } });

/** 获取币种 */
export const getCurrency = () => request.get({ url: Api.getCurrency });

/** 获取绿色信贷数据 */
export const getGreenCredit = (params: GreenCreditParams) => request.get({ url: Api.getGreenCredit, params });
